<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- bootstrap.css -->
    <link
      href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.1/css/bootstrap.min.css"
      rel="stylesheet" />
    <!-- 核心css -->
    <link rel="stylesheet" href="index.css" />
  </head>
  <body>
    <!-- 主体 -->
    <div class="container ms-0 mt-5 col-sm-12 col-md-9 col-lg-6">
      <!-- 标题-添加按钮 -->
      <div class="container d-flex justify-content-between">
        <h3>图书管理</h3>
        <button
          class="btn btn-primary add-book"
          data-bs-toggle="modal"
          data-bs-target=".addBookModal">
          +添加
        </button>
      </div>
      <!-- 表 -->
      <table class="table table-hover table-bordered border-primary mt-3">
        <!-- 表-头 -->
        <thead class="table-dark text-center">
          <tr>
            <th scope="col">序号</th>
            <th scope="col">书名</th>
            <th scope="col">作者</th>
            <th scope="col">出版社</th>
            <th scope="col">操作</th>
          </tr>
        </thead>
        <!-- 表-内容 -->
        <tbody class="book-list text-center">
          <!-- <tr>
            <th>1</th>
            <td>《西游记》</td>
            <td>吴承恩</td>
            <td>人民出版社</td>
            <td>
              <span class="del text-danger">删除</span>
              <span
                class="edit text-primary ms-3"
                data-bs-toggle="modal"
                data-bs-target=".addBookModal"
                >>编辑</span
              >
            </td>
          </tr> -->
        </tbody>
      </table>
    </div>
    <!-- 新增弹窗 -->
    <div class="modal fade addBookModal" tabindex="-1">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title text-center">添加图书</h5>
            <button
              type="button"
              class="btn-close"
              data-bs-dismiss="modal"
              aria-label="Close"></button>
          </div>
          <div class="modal-body">
            <form action="" class="add-form">
              <div class="mt-2">
                <label for="bookName" class="form-label">书名</label>
                <input
                  type="text"
                  class="form-control bookName"
                  name="bookName" />
              </div>
              <div class="mt-3">
                <label for="author" class="form-label">作者</label>
                <input
                  type="text"
                  class="form-control bookAuthor"
                  name="author" />
              </div>
              <div class="mt-3">
                <label for="publisher" class="form-label">出版社</label>
                <input
                  type="text"
                  class="form-control bookPublisher"
                  name="publisher" />
              </div>
            </form>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-secondary"
              data-bs-dismiss="modal">
              取消
            </button>
            <button type="button" class="btn btn-primary saveBtn">保存</button>
          </div>
        </div>
      </div>
    </div>
    <!-- 编辑弹窗 -->
    <div class="modal fade editBookModal" tabindex="-1">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title text-center">编辑图书</h5>
            <button
              type="button"
              class="btn-close"
              data-bs-dismiss="modal"
              aria-label="Close"></button>
          </div>
          <div class="modal-body">
            <form action="" class="edit-form">
              <input type="hidden" class="id" name="id" value="" />
              <div class="mt-2">
                <label for="bookName" class="form-label">书名</label>
                <input
                  type="text"
                  class="form-control bookName"
                  name="bookName" />
              </div>
              <div class="mt-3">
                <label for="author" class="form-label">作者</label>
                <input
                  type="text"
                  class="form-control bookAuthor"
                  name="author" />
              </div>
              <div class="mt-3">
                <label for="publisher" class="form-label">出版社</label>
                <input
                  type="text"
                  class="form-control bookPublisher"
                  name="publisher" />
              </div>
            </form>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-secondary"
              data-bs-dismiss="modal">
              取消
            </button>
            <button type="button" class="btn btn-primary editBtn">修改</button>
          </div>
        </div>
      </div>
    </div>

    <!-- bootstrap.js -->
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.1/js/bootstrap.bundle.min.js"></script>
    <!-- axios -->
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.5.0/axios.js"></script>
    <!-- 核心js -->
    <script src="./index.js"></script>
  </body>
</html>
